Authenticate User with OpenID Authentication
{ authenticateUserOPENID }
Generates a Pyramid access authentication token using OpenID authentication parameter map
Method
- Enterprise Admin
- Domain Admin
- Pro
- Analyst
- Viewer
- Basic
Input Parameters
Name
parameterMap
Object Type
Description
The user credentials for authentication by OpenID parameter map.
Output Response
Successful Result Code
200
Response Type
string
Description of Response Type
The response is the security token as a base64 string. It is usually stored in a cookie.
Notes
The security token is a string that needs to be embedded in every API call to ensure the API calls are authorized. If saved as a cookie in a web browser, it can be used (for the authenticated user) to auto-login into the application. The assumption is that the user has already authenticated via OpenID before attempting to authenticate into Pyramid.
Examples
This example demonstrates how to authenticate a user using OpenID.
// URL of the Pyramid installation and the path to the API 2.0 REST methods var pyramidURL = "http://mysite.com/api2/"; // The response from the OpenId authentication var openIdToken = "YOUR_OPEN_ID_TOKEN(RESPONSE)"; //generic method for running REST methods function callApi(path, data, parseResult = true) { var xhttp = new XMLHttpRequest(); xhttp.open("POST", pyramidURL + path, false); xhttp.send(JSON.stringify(data)); if (parseResult) { return JSON.parse(xhttp.responseText); } else { return xhttp.responseText; } } //calling the API to receive the Pyramid token let pyramidToken = callApi( "auth/authenticateUserOPENID", { data: { parameterMap: { id_token: openIdToken, state: "preferred_username", }, }, }, false ); console.log("fetch: " + pyramidToken);